<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
    <!--{include file='comm/header.tpl'}-->
    <<!--{include file='comm/comm_cal.tpl'}-->
    <style>.flexigrid{margin:10px;}</style>
    <title><!--{if $operFlg == 2}-->积分商城促销添加<!--{else}-->积分商城促销编辑<!--{/if}--></title>
    <!--{include file='comm/comm_pic.tpl'}-->
<style>
.hide{ display:none;}
</style>
</head>
<body>
<div style="width:100%; margin-bottom:50px;">

    <div class="items clearfix">

        <h2 style="" class="tal">
            <!--{if $operFlg == 2}-->积分商城促销添加<!--{else}-->积分商城促销编辑<!--{/if}-->
        </h2>
		
        <div class="items2">

            <div>
                <form id="sendForm" name="sendForm" onsubmit="return false;">
                
                	<div>
                		<div class="input-group input-group-lg">
			                <span class="input-group-addon">活动名称：</span>
			                <input type="text" style="padding-left:10px;" value="<!--{$pointsMall.promotionName|default:''}-->" placeholder="请输入活动名称【必填项】" id="promotionName" name="promotionName" class="form-control">
			                <input type="hidden" id="promotionID" name="promotionID" value="<!--{$pointsMall.promotionID|default:''}-->">
			            </div>
			            
			            <div class="input-group input-group-lg">
			                <span class="input-group-addon">活动别名：</span>
			                <input type="text" style="padding-left:10px;" value="<!--{$pointsMall.promotionIndex|default:''}-->" placeholder="请输入活动别名【必填项】" id="promotionIndex" name="promotionIndex" class="form-control">
			            </div>
			            
			            <div class="input-group input-group-lg">
			                <span class="input-group-addon">促销时间：</span>
			                <span style="padding-left:10px;" class="input-group-radio">
			                    <div>
			                        <input type="text" value="<!--{$pointsMall.startDate|default:''}-->" style="width:180px;" name="startDate" readonly="" id="startDate">
			                        ～
			                        <input type="text" value="<!--{$pointsMall.endDate|default:''}-->" style="width:180px;" name="endDate" readonly="" id="endDate">
			                    </div>
			                </span>
			            </div>
			            
			            <div class="input-group input-group-lg">
			                <span class="input-group-addon">描述：</span>
			                <textarea placeholder="请输入描述" class="form-control" id="remark" name="remark" style="height:80px;padding-left:10px;"><!--{$pointsMall.remark|default:''}--></textarea>
			            </div>
			            
			            <div class="input-group input-group-lg" style="display:none;">
			                <span class="input-group-addon">使用状态：</span>
			                <span class="input-group-radio" style="padding-left:10px;">
			                    <div>
			                        <input type="radio" name="useFlg" value="1" checked="checked">&nbsp;启用
	                                <input type="radio" name="useFlg" value="0" >&nbsp;禁用
			                    </div>
			                </span>
			            </div>
			            
			            <div class="input-group input-group-lg">
			                <span class="input-group-addon">商品规则：</span>
			                <span class="input-group-radio" style="padding-left:10px;">
								<select name="type" id="type" style="width:180px;">
                                    <option value="">请选择</option>
                                    <option value="1" <!--{if isset($pointsMall) && $pointsMall.type == 1}-->selected<!--{/if}-->>良票换券</option>
                                    <option value="2" <!--{if isset($pointsMall) && $pointsMall.type == 2}-->selected<!--{/if}-->>良票兑换</option>
                                    <option value="3" <!--{if isset($pointsMall) && $pointsMall.type == 3}-->selected<!--{/if}-->>良票换购</option>
                                </select>
			                </span>
			            </div>
    
                	</div>

                    <div id="promotionCoupon" class="promoExtend <!--{if !isset($pointsMall) || $pointsMall.type != 1}-->hide<!--{/if}-->">
						<table id="couponFlex" style="font-size:12px; float:left; width:100px;">
							<tr id="row_0">
								<td axis="col0" class="">
									<input type="text" value="" name="points" id="points" style="width:120px;">
								</td>
								<td axis="col1" class="">
									<select name="couponID" id="couponID" onchange="promotionAdd.checkCoupon();">
										<option value="">请选择</option>
										<!--{if isset($accountCoupon) && $accountCoupon}-->
											<!--{foreach from=$accountCoupon item=c_l}-->
											<option value="<!--{$c_l->couponID}-->" <!--{if $c_l->couponID == $pointsConvertInfo->couponID}--> selected <!--{/if}--> ><!--{$c_l->couponName}--></option>
											<!--{/foreach}-->
										<!--{/if}-->
									</select>
								</td>
								<td axis="col2" class="">
									<input type="button" value="添加" class="btn" onclick="promotionAdd.addLine();" />
								</td>
							</tr>
							<!--{if isset($pointsMallDetail)}-->
							<!--{foreach from=$pointsMallDetail item=item key=key}-->
							<tr id="row_<!--{$item.id}-->" style="line-height:30px;">
								<td axis="col0" class="">
									<input type="hidden" name="row_points_<!--{$item.id}-->" value="<!--{$item.points}-->_<!--{$item.id}-->">
									<input type="hidden" name="row_couponName_<!--{$item.id}-->" value="<!--{$item.name}-->">
									&nbsp;&nbsp;&nbsp;&nbsp;<!--{$item.points}-->
								</td>
								<td axis="col1" class="">&nbsp;&nbsp;&nbsp;&nbsp;<!--{$item.name}--></td>
								<td axis="col3" style="text-align: center;">
									<input type="button" style="margin-top:2px;" onclick="promotionAdd.removeLine('row_<!--{$item.id}-->');" class="btn" value="移除">
								</td>
							</tr>
							<!--{/foreach}-->
							<!--{/if}-->
						</table>
					</div>
					<div id="promotionExchange" class="promoExtend <!--{if !isset($pointsMall) || $pointsMall.type != 2}-->hide<!--{/if}-->"><!--积分兑换商品-->
						<table id="exchangeFlex" style="font-size:12px; float:left; width:100px;">
							<tr id="row_0">
								<td axis="col0" class="">
									<input type="text" value="" name="exchange_product_code" id="exchange_product_code" style="width:120px;">
								</td>
								<td axis="col1" class="">
									<div class="" >
									
									</div>
								</td>
								<td axis="col2" class="">
									<input type="text" value="" name="exchange_points" id="exchange_points" style="width:80px;">
								</td>
								<td axis="col3" class="">
									0.00元
								</td>
								<td axis="col4" class="">
									<input type="button" value="添加" class="btn" onclick="promotionAdd.addLine();" />
								</td>
							</tr>
							<!--{if isset($pointsMallDetail) && pointsMallDetail}-->
							<!--{foreach from=$pointsMallDetail item=item key=key}-->
							<tr id="row_<!--{$item.id}-->" style="line-height:22px;">
				        		<td axis="col0" class=""><!--{$item.id}--></td>
								<td axis="col1" class="">
									<div class="" >
									<input type="hidden" name="row_exchange_<!--{$item.id}-->" value="<!--{$item.id}-->_<!--{$item.points}-->_<!--{$item.bigCategoryID}-->">
									<input type="hidden" name="row_goodsName_exchange_<!--{$item.id}-->" value="<!--{$item.name}-->">
									<!--{$item.name}-->
									</div>
								</td>
								<td axis="col2" class=""><!--{$item.points}--></td>
								<td axis="col3" class="">0.00元</td>
								<td axis="col4" class="" style="text-align: center;">
									<input style="margin-top:2px;" type="button" value="移除" class="btn" onclick="promotionAdd.removeLine('row_<!--{$item.id}-->');" />
								</td>
							</tr>
							<!--{/foreach}-->
							<!--{/if}-->
						</table>
					</div>
					<div id="promotionTrade" class="promoExtend <!--{if !isset($pointsMall) || $pointsMall.type != 3}-->hide<!--{/if}-->"><!--积分换购商品-->
						<table id="tradeFlex" style="font-size:12px; float:left; width:100px;">
							<tr id="row_0">
								<td axis="col0" class="">
									<input type="text" value="" name="trade_product_code" id="trade_product_code" style="width:120px;">
								</td>
								<td axis="col1" class="">
									<div class="" >
									
									</div>
								</td>
								<td axis="col2" class="">
									<input type="text" value="" name="trade_points" id="trade_points" style="width:80px;">
								</td>
								<td axis="col3" class="">
									<input type="text" value="" name="trade_points_price" id="trade_points_price" style="width:80px;">
								</td>
								<td axis="col4" class="">
									<input type="button" value="添加" class="btn" onclick="promotionAdd.addLine();" />
								</td>
							</tr>
							<!--{if isset($pointsMallDetail) && pointsMallDetail}-->
							<!--{foreach from=$pointsMallDetail item=item key=key}-->
							<tr id="row_<!--{$item.id}-->" style="line-height:22px;">
				        		<td axis="col0" class=""><!--{$item.id}--></td>
								<td axis="col1" class="">
									<div class="" >
										<input type="hidden" name="row_trade_<!--{$item.id}-->" value="<!--{$item.id}-->_<!--{$item.points}-->_<!--{$item.pointsPrice}-->_<!--{$item.bigCategoryID}-->">
										<input type="hidden" name="row_goodsName_trade_<!--{$item.id}-->" value="<!--{$item.name}-->">
										<!--{$item.name}-->
									</div>
								</td>
								<td axis="col2" class=""><!--{$item.points}--></td>
								<td axis="col3" class=""><!--{$item.pointsPrice|string_format:"%.2f"}-->元</td>
								<td axis="col4" class="" style="text-align: center;">
									<input style="margin-top:2px;" type="button" value="移除" class="btn" onclick="promotionAdd.removeLine('row_<!--{$item.id}-->');" />
								</td>
							</tr>
							<!--{/foreach}-->
							<!--{/if}-->
						</table>
					</div>
            </form>
        </div>
		
    </div>
</div>

<div class="bottom_fixbox">
    <div class="rectbox tac">
        <input type="hidden" id ="dataCache" name="dataCache" value="">
        <input type="button" class="btn" onclick="promotionAdd.check();" value="<!--{if $operFlg == 2}-->积分商城促销添加<!--{else}-->积分商城促销编辑<!--{/if}-->" />&nbsp;&nbsp;&nbsp;
        <input type="button" class="btn" onclick="E.closeWindows();" value="关闭" />
    </div>
</div>

</div>

<script>
	
	$('select[id=type]').change(function(){
		$('div.promoExtend').addClass('hide');
		var i = $('select[id=type]').val();
		if ( i == 1 ) {
			$('#promotionCoupon').removeClass('hide');
		} else if ( i == 2 ) {
			$('#promotionExchange').removeClass('hide');
		} else if ( i == 3 ) {
			$('#promotionTrade').removeClass('hide');
		}
	});
	
	$("#couponFlex").flexigrid({
        url:"",
        dataType: "json",
        colModel : [
            {display: "良票", width:200 , align:"center" },
            {display: "优惠券", width:260 , align:"center" },
            {display: "操作", width:100 , align:"center" },
        ],
        buttons : [
            {name: "删除", bclass: "delete", onpress : "promotionAdd.removeRow"}
        ],
        useRp: true,
        showTableToggleBtn: true
    });
    
    $("#exchangeFlex,#tradeFlex").flexigrid({
        url:"",
        dataType: "json",
        colModel : [
            {display: "商家编码", width:150 , },
            {display: "商品名称", width:310 , },
            {display: "良票价格",width:100 ,  },
            {display: "兑换价格", width:100 ,},
            {display: "操作", width:100 , align:"center"},
        ],
        buttons : [
            {name: "删除", bclass: "delete", onpress : "promotionAdd.removeRow"}
        ],
        useRp: true,
        showTableToggleBtn: true
    });
    
    $('#exchange_product_code,#trade_product_code').live("keydown",function( e ){
		if(e.keyCode == 13){
			
			var startDate = $('input[id=startDate]').val();
			var endDate = $('input[id=endDate]').val();
			var product_code = $(this).val();
			var promotionID = $('#promotionID').val(); //促销ID
			
			if ( E.isEmpty(product_code) ) {
				E.alert('请填写正确的商品编码');
				return false;
			}
			
			var type = $('#type').val();
			
			var flg = 0;
			if ( type == 2 ) {
				$.each($('input[name^=row_exchange_]'),function(){
        			var value = $(this).val();
        			var arr = value.split('_');
        			if (arr[0] == product_code) {
        				flg = 1;
        			}
        		});
			} else if ( type == 3 ) {
				$.each($('input[name^=row_trade_]'),function(){
        			var value = $(this).val();
        			var arr = value.split('_');
        			if (arr[0] == product_code) {
        				flg = 1;
        			}
        		});
			}
			
			if ( flg == 1 ) {
				E.alert('该商品已添加');
				return false;
			} else {
				E.loadding.open('正在验证商品，请稍等......');
				E.ajax_post({
					url:'/invokingAjax-backend/promotion/pointsMall.ajax?operFlg=5',
					data:{
						product_code:product_code,
						startDate: startDate,
						endDate: endDate,
						promotionID:promotionID
					},
					call:'promotionAdd.checkResult'
				});
			}
		}
    });
    
    var operFlg = '<!--{$operFlg}-->';

    var promotionAdd = {
    	
    	//检查优惠是否在积分商城的其他促销中使用过
    	checkCoupon: function(){
    		var startDate = $('#startDate').val();
    		var endDate = $('#endDate').val();
    		var couponID = $('#couponID').val();
    		var promotionID = $('#promotionID').val(); //促销ID
    		
    		if (!couponID) {
    			return false;
    		}
    		
    		E.loadding.open('正在检查数据，请稍等......');
    		E.ajax_post({
    			url:"/invokingAjax-backend/promotion/pointsMall.ajax?operFlg=6",
    			data:{
    				couponID:couponID,
    				startDate:startDate,
    				endDate:endDate,
    				promotionID:promotionID
    			},
    			call:"promotionAdd.checkCouponResult"
    		});
    	},
    	
    	checkCouponResult: function( o ){
    		E.loadding.close();
    		if ( o.code != 200 ) {
    			$('#couponID').val('');
    			E.alert( o.message );
    			return false;
    		}
    	}, 
    	
    	checkResult: function( o ){
    		
    		var type = $('#type').val();
    		
    		E.loadding.close();
    		if ( o.code == 200 ) {
    			
    			if ( type == 2 ) { //积分兑换商品
    				var html = '';
	    			html += '<input type="hidden" value="'+o.data.product_code+'" goodsName="'+o.data.goodsName+'" bigCategoryID="'+o.data.bigCategoryID+'" id="exchange_goods_info" />' + o.data.goodsName.substring(0,28);
	    			$('table#exchangeFlex tr#row_0 td[axis=col1] div').html(html);
    			} else if ( type == 3 ) { //积分换购商品
    				var html = '';
	    			html += '<input type="hidden" value="'+o.data.product_code+'" goodsName="'+o.data.goodsName+'" bigCategoryID="'+o.data.bigCategoryID+'" id="trade_goods_info" />' + o.data.goodsName.substring(0,28);
	    			$('table#tradeFlex tr#row_0 td[axis=col1] div').html(html);
    			}
    		} else {
    			E.alert( o.message );
    		}
    	},

        //检查数据
        check: function() {

            this.dt = E.getFormValues("sendForm") ;

            var error_msg = "";
            
			//活动名称
            if (this.dt.promotionName == "")
                error_msg += "活动名称不能为空<br />";
                
            //活动别名
            if( this.dt.promotionIndex == '' )
                error_msg += "请输入分类别名<br />";
			
            //促销时间
            if( this.dt.startDate == '' ){
                error_msg += "请输入促销开始时间<br />";
            }else{
                if (!E.isDate(this.dt.startDate))
                    error_msg += "促销开始时间格式不正确<br />";
            }

            if( this.dt.endDate == '' ){
                error_msg += "请输入促销结束时间<br />";
            }else{
                if (!E.isDate(this.dt.endDate))
                    error_msg += "促销结束时间格式不正确<br />";
            }

            if(this.dt.startDate > this.dt.endDate)
                error_msg += "促销开始时间不能大于结束时间<br />";
			
            
            
            //使用状态
            if( this.dt.useFlg != '1' && this.dt.useFlg != '0' ){
                error_msg += "请选择使用状态<br />";
            }
			
            if (error_msg != "") {
                E.alert(error_msg);
            } else {
                promotionAdd.add();
            }
            
        },
		
        //保存积分兑换信息
        add: function() {
            $.ajax({
                type: "POST",
                url: "/invokingAjax-backend/promotion/pointsMall.ajax?operFlg=2" ,
                dataType: "JSON",
                data: this.dt,
                success: function( result_obj ) {
                    if (result_obj.code == 200) {

                        E.opener("promotion.load");

                        if( operFlg == 2 ){
                            E.alert(result_obj.message, 2 , "E.refresh");
                        }else{
                            E.alert(result_obj.message, 2 , "E.closeWindows");
                        }

                    } else {
                        E.alert(result_obj.message);
                    }
                }
            });
        },
        
        //添加一行
        addLine: function(){
        	
        	//类型
        	var type = $('#type').val();
        	
        	//判断类型
        	if ( type != 1 && type != 2 && type != 3) {
        		E.alert('参数错误');
        		return false;
        	}
        	
        	if ( type == 1 ) { //积分兑换优惠券
        		
        		var points = E.trim($('#points').val()); //积分
        		var couponID = $('#couponID').val(); //选择的优惠券ID
        		var couponName = $('#couponID').find('option:selected').text(); //选择的优惠券名称
        		var error_msg = ''; //错误信息
        		
        		//积分金额
        		if (E.isEmpty(points) ||  !E.isDigital(points) ) {
        			error_msg += '请输入正确的积分<br/>';
        		}
        		
        		//优惠券ID
        		if (E.isEmpty(couponID) || !E.isDigital(couponID) ) {
        			error_msg += '请选择优惠券<br/>';
        		}
        		
        		if ( error_msg ) {
        			E.alert( error_msg );
        			return false;
        		}
        		
        		var flg = 0; //已被选择标记
        		//检查当前选择的优惠券是否已经添加
        		if ($('input[name^=row_points_]')) {
        			$.each($('input[name^=row_points_]'),function(){
	        			var value = $(this).val();
	        			var arr = value.split('_');
	        			if (arr[1] == couponID) {
	        				flg = 1;
	        			}
	        		});
        		}
        		
        		if ( flg == 1 ) {
        			E.alert('当前优惠券已经选择');
        		} else {
	        		var html = '';
					html += '<tr style="line-height:30px;" id="row_'+couponID+'" class="erow">';
					html += '<td class="" axis="col0"><div style="text-align: center; width: 200px;">';
					html += '<input type="hidden" value="'+points+'_'+couponID+'" name="row_points_'+couponID+'">';
					html += '<input type="hidden" value="'+couponName+'" name="row_couponName_'+couponID+'">';
					html += '&nbsp;&nbsp;&nbsp;&nbsp;'+points+'';
					html += '</div></td>';
					html += '<td class="" axis="col1"><div style="text-align: center; width: 260px;">&nbsp;&nbsp;&nbsp;&nbsp;'+couponName+'</div></td>';
					html += '<td style="text-align: center;" axis="col3"><div style="text-align: center; width: 100px;">';
					html += '<input type="button" value="移除" class="btn" onclick="promotionAdd.removeLine(\'row_'+couponID+'\');" style="margin-top:2px;">';
					html += '</div></td>';
					html += '</tr>';
					
					$("#couponFlex").append(html);
					$('#points').val('').focus();
					$('#couponID').find('option[value=""]').attr("selected",true);
        		}
        	} else if ( type == 2 ) { //积分兑换商品
        		
        		var product_code = $('input[id=exchange_goods_info]').val(); //商品编码
        		var goods_name = $('input[id=exchange_goods_info]').attr('goodsname'); //商品名称
        		var bigCategoryID = $('input[id=exchange_goods_info]').attr('bigCategoryID'); //商品大分类
        		var points = $('input[id=exchange_points]').val();
        		var pointsPrice  = 0; //积分兑换积分兑换价格为0
        		var error_msg = ''; //错误提示
        		
        		if ( E.isEmpty(product_code) ) {
        			error_msg += '请输入正确的商品编码<br/>';
        		}
        		
        		if ( !E.isDigital(points) ) {
        			error_msg += '请输入正确的积分<br/>';
        		}
        		
        		if ( error_msg ) {
        			E.alert( error_msg );
        			return false;
        		}
        		
        		var flg = 0; //商品已选择标记
        		$.each($('input[name^=row_exchange_]'),function(){
        			var value = $(this).val();
        			var arr = value.split('_');
        			if (arr[0] == product_code) {
        				flg = 1;
        			}
        		});
        		
        		if ( flg == 1 ) {
        			
        			E.alert('该商品已经添加');
        			return false;
        			
        		} else {
        		
	        		var html = '';
					html += '<tr style="line-height:22px;" id="row_'+product_code+'" class="erow">';
					html += '<td class="" axis="col0"><div style="width: 150px;">'+product_code+'</div></td>';
					html += '<td class="" axis="col1"><div style="width: 310px;">';
					html += '<div class="">';
					html += '<input type="hidden" value="'+product_code+'_'+points+'_'+bigCategoryID+'" name="row_exchange_'+product_code+'">';
					html += '<input type="hidden" value="'+goods_name+'" name="row_goodsName_exchange_'+product_code+'">';
					html += goods_name;
					html += '</div>';
					html += '</div></td>';
					html += '<td class="" axis="col2"><div style="width: 100px;">'+points+'</div></td>';
					html += '<td class="" axis="col3"><div style="width: 100px;">0.00元</div></td>';
					html += '<td style="text-align: center;" class="" axis="col4"><div style="text-align: center; width: 100px;">';
					html += '<input type="button" onclick="promotionAdd.removeLine(\'row_'+product_code+'\');" class="btn" value="移除" style="margin-top:2px;">';
					html += '</div></td>';
					html += '</tr>';
					
	        		$("#exchangeFlex").append(html);
	        		$('#exchange_product_code').val('');
	        		$('#exchangeFlex tr#row_0 td[axis=col1] div').html('');
	        		$('#exchange_points').val('');
        		}
        		
        	} else if ( type == 3 ) { //积分换购商品
        		
        		var product_code = $('#trade_goods_info').val(); //商家编码
        		var goods_name = $('#trade_goods_info').attr('goodsName'); //商品名称
        		var bigCategoryID = $('#trade_goods_info').attr('bigCategoryID'); //商品大分类
        		var points = $('#trade_points').val(); //积分价格
        		var pointsPrice = $('#trade_points_price').val(); //积分换购价格
        		var error_msg = ''; //错误信息
        		
        		if ( E.isEmpty(product_code) ) {
        			error_msg += '请输入正确的商家编码<br/>';
        		}
        		
        		if ( !E.isDigital(points) ) {
        			error_msg += '请输入正确的良票价格<br/>';
        		}
        		
        		if ( !E.isMoney(pointsPrice) ) {
        			error_msg += '请输入正确的良票兑换价格<br/>';
        		}
        		
        		if ( error_msg ) {
        			E.alert( error_msg );
        			return false;
        		}
        		
        		var flg = 0; //商品选择标记
        		$.each($('input[name^=row_trade_]'),function(){
        			var value = $(this).val();
        			var arr = value.split('_');
        			if (arr[0] == product_code) {
        				flg = 1;
        			}
        		});
        		
        		if ( flg == 1 ) {
        			E.alert('该商品已经添加');
        			return false;
        		} else {
	        		var html = '';
					html += '<tr style="line-height:22px;" id="row_'+product_code+'" class="erow">';
					html += '<td class="" axis="col0"><div style="width: 150px;">'+product_code+'</div></td>';
					html += '<td class="" axis="col1"><div style="width: 310px;">';
					html += '<div class="">';
					html += '<input type="hidden" value="'+product_code+'_'+points+'_'+pointsPrice+'_'+bigCategoryID+'" name="row_trade_'+product_code+'">';
					html += '<input type="hidden" value="'+goods_name+'" name="row_goodsName_trade_'+product_code+'">';
					html += ''+goods_name+'';
					html += '</div>';
					html += '</div></td>';
					html += '<td class="" axis="col2"><div style="width: 100px;">'+points+'</div></td>';
					html += '<td class="" axis="col3"><div style="width: 100px;">'+parseFloat(pointsPrice).toFixed(2)+'元</div></td>';
					html += '<td style="text-align: center;" class="" axis="col4"><div style="text-align: center; width: 100px;">';
					html += '<input type="button" onclick="promotionAdd.removeLine(\'row_'+product_code+'\');" class="btn" value="移除" style="margin-top:2px;">';
					html += '</div></td>';
					html += '</tr>';
							
	        		$("#tradeFlex").append(html);
	        		$('#trade_product_code').val('');
	        		$('#tradeFlex tr#row_0 td[axis=col1] div').html('');
	        		$('#trade_points').val('');
	        		$('#trade_points_price').val('');
        		}
        	}
        	
        },
        
        //删除一行
        removeLine: function( id ){
        	var type = $('#type').val();
        	
        	if ( type == 1 ) { //积分兑换优惠券
        		$('#couponFlex tr#' + id).remove();
        	} else if ( type == 2 ) { //积分兑换商品
        		$('#exchangeFlex tr#' + id).remove();
        	} else if ( type == 3 ) { //积分换购商品
        		$('#tradeFlex tr#' + id).remove();
        	}
        },
        
        //删除多行
        removeRow: function(){
        	$.each($('.trSelected'),function(){
        		$(this).remove();
        	});
        }

    };

</script>
<script>
	$('#startDate').datetimepicker({timeFormat:'HH:mm:ss',showHour: true,showMinute: true,showSecond: true,});
	$('#endDate').datetimepicker({timeFormat:'HH:mm:ss',showHour: true,showMinute: true,showSecond: true,});
</script>
</body>
</html>